package com.mrxy.mouse.controller;

import com.alibaba.fastjson.JSONObject;
import com.mrxy.mouse.utils.HttpClientUtil;
import org.springframework.util.StringUtils;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.HashMap;
import java.util.Map;

/**
 * @author 朝花不迟暮
 * @version 1.0
 * @date 2020/11/7 22:17
 */
@RestController
public class SearchController
{
    @GetMapping("/mr/qq")
    public JSONObject resQQ(String qq) {
        if(!StringUtils.isEmpty(qq)){
            Map<String, Object> map = new HashMap<>();
            map.put("user","chunlei");
            map.put("key","***");
            map.put("engine","qq");
            map.put("choice","qq");
            map.put("info",qq);
            String info = HttpClientUtil.doGet("http://api.data007.org/api", map);
            JSONObject jsonObject = JSONObject.parseObject(info);
            return jsonObject;
        }
        return null;
    }
}
